<?php if(!class_exists("View", false)) exit("no direct access allowed");?><!-- 认证审核页面 -->
<main class="flex-1 ml-64 flex flex-col h-screen overflow-hidden" id="mainContent">
    <?php include $_view_obj->compile("main_header.html"); ?>
    
    <!-- 内容区域 -->
    <div class="flex-1 overflow-y-auto p-6 scrollbar-thin">
        
        <!-- 数据概览 -->
        <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-5 gap-6 mb-6">
            <div class="bg-white rounded-xl shadow-sm p-5 border border-neutral-200 col-span-1 md:col-span-2 lg:col-span-1">
                <div class="flex items-start justify-between mb-4">
                    <div>
                        <p class="text-neutral-500 text-sm">待审核总数</p>
                        <h3 class="text-2xl font-bold mt-1" id="totalPending">156</h3>
                    </div>
                    <div class="w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center text-primary">
                        <i class="fa fa-clock-o"></i>
                    </div>
                </div>
                <div class="flex items-center text-sm" id="totalPendingTrend">
                    <span class="text-danger flex items-center">
                        <i class="fa fa-arrow-up mr-1"></i> 8.3%
                    </span>
                    <span class="text-neutral-400 ml-2">较昨日</span>
                </div>
            </div>
            
            <div class="bg-white rounded-xl shadow-sm p-5 border border-neutral-200">
                <div class="flex items-start justify-between mb-4">
                    <div>
                        <p class="text-neutral-500 text-sm">个人认证</p>
                        <h3 class="text-2xl font-bold mt-1" id="personalCount">89</h3>
                    </div>
                    <div class="w-10 h-10 rounded-lg bg-secondary/10 flex items-center justify-center text-secondary">
                        <i class="fa fa-user"></i>
                    </div>
                </div>
                <div class="flex items-center text-sm" id="personalCountTrend">
                    <span class="text-success flex items-center">
                        <i class="fa fa-arrow-down mr-1"></i> 2.1%
                    </span>
                    <span class="text-neutral-400 ml-2">较昨日</span>
                </div>
            </div>
            
            <div class="bg-white rounded-xl shadow-sm p-5 border border-neutral-200">
                <div class="flex items-start justify-between mb-4">
                    <div>
                        <p class="text-neutral-500 text-sm">企业认证</p>
                        <h3 class="text-2xl font-bold mt-1" id="companyCount">42</h3>
                    </div>
                    <div class="w-10 h-10 rounded-lg bg-success/10 flex items-center justify-center text-success">
                        <i class="fa fa-building"></i>
                    </div>
                </div>
                <div class="flex items-center text-sm" id="companyCountTrend">
                    <span class="text-danger flex items-center">
                        <i class="fa fa-arrow-up mr-1"></i> 12.5%
                    </span>
                    <span class="text-neutral-400 ml-2">较昨日</span>
                </div>
            </div>
            
            <div class="bg-white rounded-xl shadow-sm p-5 border border-neutral-200">
                <div class="flex items-start justify-between mb-4">
                    <div>
                        <p class="text-neutral-500 text-sm">媒体/机构</p>
                        <h3 class="text-2xl font-bold mt-1" id="orgCount">25</h3>
                    </div>
                    <div class="w-10 h-10 rounded-lg bg-warning/10 flex items-center justify-center text-warning">
                        <i class="fa fa-institution"></i>
                    </div>
                </div>
                <div class="flex items-center text-sm" id="orgCountTrend">
                    <span class="text-success flex items-center">
                        <i class="fa fa-arrow-down mr-1"></i> 3.7%
                    </span>
                    <span class="text-neutral-400 ml-2">较昨日</span>
                </div>
            </div>
            
            <div class="bg-white rounded-xl shadow-sm p-5 border border-neutral-200">
                <div class="flex items-start justify-between mb-4">
                    <div>
                        <p class="text-neutral-500 text-sm">今日已处理</p>
                        <h3 class="text-2xl font-bold mt-1" id="todayProcessed">36</h3>
                    </div>
                    <div class="w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center text-primary">
                        <i class="fa fa-check-square-o"></i>
                    </div>
                </div>
                <div class="flex items-center text-sm" id="todayProcessedTrend">
                    <span class="text-success flex items-center">
                        <i class="fa fa-arrow-up mr-1"></i> 5.2%
                    </span>
                    <span class="text-neutral-400 ml-2">较昨日</span>
                </div>
            </div>
        </div>
        
        <!-- 审核筛选和操作 -->
        <div class="bg-white rounded-xl shadow-sm border border-neutral-200 mb-6 overflow-hidden">
            <div class="p-5 border-b border-neutral-200">
                <div class="flex flex-wrap items-center justify-between gap-4">
                    <h3 class="font-bold">认证申请列表</h3>
                    
                    <div class="flex flex-wrap items-center gap-3">
                        <div class="relative">
                            <select class="appearance-none bg-neutral-100 border border-neutral-200 text-sm rounded-lg px-4 py-2 pr-8 focus:outline-none focus:ring-2 focus:ring-primary/30 focus:border-primary" id="certTypeFilter">
                                <option value="0">全部认证类型</option>
                                <option value="1">个人认证</option>
                                <option value="2">企业认证</option>
                                <option value="3">媒体认证</option>
                                <option value="4">党政机关认证</option>
                                <option value="5">其他组织认证</option>
                            </select>
                            <i class="fa fa-chevron-down absolute right-3 top-1/2 -translate-y-1/2 text-neutral-400 text-xs pointer-events-none"></i>
                        </div>

                        <div class="relative">
                            <select class="appearance-none bg-neutral-100 border border-neutral-200 text-sm rounded-lg px-4 py-2 pr-8 focus:outline-none focus:ring-2 focus:ring-primary/30 focus:border-primary" id="auditStatusFilter">
                                <option value="0">全部状态</option>
                                <option value="1">待审核</option>
                                <option value="2">审核通过</option>
                                <option value="3">审核拒绝</option>
                                <option value="4">已撤回</option>
                            </select>
                            <i class="fa fa-chevron-down absolute right-3 top-1/2 -translate-y-1/2 text-neutral-400 text-xs pointer-events-none"></i>
                        </div>
                        
                        <div class="relative">
                            <select class="appearance-none bg-neutral-100 border border-neutral-200 text-sm rounded-lg px-4 py-2 pr-8 focus:outline-none focus:ring-2 focus:ring-primary/30 focus:border-primary" id="sortFilter">
                                <option value="0">默认排序</option>
                                <option value="1">申请时间 降序</option>
                                <option value="2">申请时间 升序</option>
                                <option value="3">审核次数 降序</option>
                            </select>
                            <i class="fa fa-chevron-down absolute right-3 top-1/2 -translate-y-1/2 text-neutral-400 text-xs pointer-events-none"></i>
                        </div>
                        
                        <button class="bg-primary hover:bg-primary/90 text-white text-sm px-4 py-2 rounded-lg transition-colors" id="filterBtn">
                            <i class="fa fa-filter mr-1"></i> 筛选
                        </button>
                        
                        <button class="bg-neutral-100 hover:bg-neutral-200 text-neutral-700 text-sm px-4 py-2 rounded-lg transition-colors" id="resetBtn">
                            <i class="fa fa-refresh mr-1"></i> 重置
                        </button>
                    </div>
                </div>
                
                <div class="mt-4 grid grid-cols-1 md:grid-cols-4 gap-4">
                    <div>
                        <label class="block text-xs text-neutral-500 mb-1">申请ID/用户ID</label>
                        <input type="text" class="w-full bg-neutral-100 border border-neutral-200 text-sm rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-primary/30 focus:border-primary" id="keywordSearch" placeholder="请输入申请ID或用户ID">
                    </div>
                    
                    <div>
                        <label class="block text-xs text-neutral-500 mb-1">申请人/公司名称</label>
                        <input type="text" class="w-full bg-neutral-100 border border-neutral-200 text-sm rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-primary/30 focus:border-primary" id="nameSearch" placeholder="请输入申请人姓名或公司名称">
                    </div>
                    
                    <div>
                        <label class="block text-xs text-neutral-500 mb-1">申请时间范围</label>
                        <div class="flex space-x-2">
                            <input type="date" class="flex-1 bg-neutral-100 border border-neutral-200 text-sm rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-primary/30 focus:border-primary" id="startDate">
                            <span class="flex items-center text-neutral-400">至</span>
                            <input type="date" class="flex-1 bg-neutral-100 border border-neutral-200 text-sm rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-primary/30 focus:border-primary" id="endDate">
                        </div>
                    </div>
                    
                    <div>
                        <label class="block text-xs text-neutral-500 mb-1">审核人</label>
                        <input type="text" class="w-full bg-neutral-100 border border-neutral-200 text-sm rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-primary/30 focus:border-primary" id="auditorSearch" placeholder="请输入审核人姓名">
                    </div>
                </div>
            </div>

            <!-- 批量操作工具栏 -->
            <div class="p-5 border-b border-neutral-200 flex flex-wrap items-center justify-between gap-4">
                <div class="flex items-center space-x-3">
                    <button class="bg-primary hover:bg-primary/90 text-white text-sm px-4 py-2 rounded-lg transition-colors" id="batchClaimBtn">
                        <i class="fa fa-hand-paper-o mr-1"></i> 批量认领
                    </button>
                    <button class="bg-success hover:bg-success/90 text-white text-sm px-4 py-2 rounded-lg transition-colors" id="batchApproveBtn">
                        <i class="fa fa-check mr-1"></i> 批量通过
                    </button>
                    <button class="bg-danger hover:bg-danger/90 text-white text-sm px-4 py-2 rounded-lg transition-colors" id="batchRejectBtn">
                        <i class="fa fa-times mr-1"></i> 批量拒绝
                    </button>
                    <button class="bg-neutral-100 hover:bg-neutral-200 text-neutral-700 text-sm px-4 py-2 rounded-lg transition-colors" id="batchReviewBtn">
                        <i class="fa fa-flag mr-1"></i> 批量标记复查
                    </button>
                    <span class="text-sm text-neutral-500 ml-3" id="selectedCount">已选择 0 项</span>
                </div>
            </div>
            
            <!-- 认证申请列表 -->
            <div class="overflow-x-auto">
                <table class="w-full" id="certificationTable">
                    <thead>
                        <tr class="bg-neutral-50 text-left">
                            <th class="px-5 py-3 text-xs font-medium text-neutral-500 uppercase tracking-wider">
                                <input type="checkbox" id="selectAll" class="rounded border-neutral-300 text-primary focus:ring-primary">
                            </th>
                            <th class="px-5 py-3 text-xs font-medium text-neutral-500 uppercase tracking-wider">申请ID</th>
                            <th class="px-5 py-3 text-xs font-medium text-neutral-500 uppercase tracking-wider">认证类型</th>
                            <th class="px-5 py-3 text-xs font-medium text-neutral-500 uppercase tracking-wider">申请人/单位</th>
                            <th class="px-5 py-3 text-xs font-medium text-neutral-500 uppercase tracking-wider">申请时间</th>
                            <th class="px-5 py-3 text-xs font-medium text-neutral-500 uppercase tracking-wider">认领状态</th>
                            <th class="px-5 py-3 text-xs font-medium text-neutral-500 uppercase tracking-wider">审核状态</th>
                            <th class="px-5 py-3 text-xs font-medium text-neutral-500 uppercase tracking-wider">审核次数</th>
                            <th class="px-5 py-3 text-xs font-medium text-neutral-500 uppercase tracking-wider">操作</th>
                        </tr>
                    </thead>
                    <tbody class="divide-y divide-neutral-200 bg-white" id="certificationTableBody">
                        <!-- 表格内容将通过JS动态加载 -->
                    </tbody>
                </table>
            </div>
            
            <!-- 分页 -->
            <div class="px-5 py-4 border-t border-neutral-200 flex items-center justify-between">
                <div class="text-sm text-neutral-500 pagenation">
                    显示 1 至 10 条，共 156 条
                </div>
                <div class="flex space-x-1" id="certificationPagination">
                    <button class="w-8 h-8 flex items-center justify-center rounded border border-neutral-200 text-neutral-400 hover:border-primary hover:text-primary disabled:opacity-50" disabled>
                        <i class="fa fa-angle-left"></i>
                    </button>
                    <button class="w-8 h-8 flex items-center justify-center rounded border border-primary bg-primary text-white">1</button>
                    <button class="w-8 h-8 flex items-center justify-center rounded border border-neutral-200 hover:border-primary hover:text-primary">2</button>
                    <button class="w-8 h-8 flex items-center justify-center rounded border border-neutral-200 hover:border-primary hover:text-primary">3</button>
                    <button class="w-8 h-8 flex items-center justify-center rounded border border-neutral-200 hover:border-primary hover:text-primary">4</button>
                    <button class="w-8 h-8 flex items-center justify-center rounded border border-neutral-200 hover:border-primary hover:text-primary">5</button>
                    <button class="w-8 h-8 flex items-center justify-center rounded border border-neutral-200 hover:border-primary hover:text-primary">
                        <i class="fa fa-angle-right"></i>
                    </button>
                </div>
            </div>
        </div>
    </div>
</main>

<!-- 认证详情模态框 -->
<div class="fixed inset-0 bg-black/50 z-50 hidden items-center justify-center" id="detailModal">
    <div class="bg-white rounded-xl w-full max-w-4xl max-h-[90vh] overflow-hidden flex flex-col">
        <div class="p-5 border-b border-neutral-200 flex items-center justify-between">
            <h3 class="text-lg font-bold" id="detailTitle">认证申请详情</h3>
            <button class="text-neutral-400 hover:text-neutral-600" id="closeDetailModal">
                <i class="fa fa-times"></i>
            </button>
        </div>
        
        <div class="flex-1 overflow-y-auto p-5" id="detailContent">
            <!-- 详情内容将通过JS动态加载 -->
        </div>
        
        <div class="p-5 border-t border-neutral-200 flex justify-end space-x-3">
            <button class="px-4 py-2 border border-neutral-200 rounded-lg hover:bg-neutral-50 transition-colors" id="closeDetailBtn">关闭</button>
            <button class="px-4 py-2 bg-primary text-white rounded-lg hover:bg-primary/90 transition-colors" id="handleDetailBtn">处理审核</button>
        </div>
    </div>
</div>

<!-- 审核操作模态框 -->
<div class="fixed inset-0 bg-black/50 z-50 hidden items-center justify-center" id="auditModal">
    <div class="bg-white rounded-xl w-full max-w-md p-6">
        <h3 class="text-lg font-bold mb-2" id="auditModalTitle">审核操作</h3>
        <p class="text-neutral-500 mb-4" id="auditModalMessage">请对该认证申请进行审核操作</p>
        
        <div class="mb-4">
            <div class="flex space-x-4 mb-4">
                <label class="inline-flex items-center">
                    <input type="radio" name="auditResult" value="2" class="text-primary focus:ring-primary" checked>
                    <span class="ml-2 text-sm">审核通过</span>
                </label>
                <label class="inline-flex items-center">
                    <input type="radio" name="auditResult" value="3" class="text-primary focus:ring-primary">
                    <span class="ml-2 text-sm">审核拒绝</span>
                </label>
            </div>
            
            <div id="rejectReasonContainer" class="hidden">
                <label class="block text-sm font-medium mb-1">拒绝原因</label>
                <textarea class="w-full border border-neutral-200 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/30 focus:border-primary" rows="3" id="rejectReason" placeholder="请输入拒绝原因..."></textarea>
            </div>
            
            <div class="mt-4">
                <label class="block text-sm font-medium mb-1">审核备注（可选）</label>
                <textarea class="w-full border border-neutral-200 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/30 focus:border-primary" rows="3" id="auditRemark" placeholder="请输入审核备注..."></textarea>
            </div>
        </div>
        
        <div class="flex space-x-3">
            <button class="flex-1 py-2 border border-neutral-200 rounded-lg hover:bg-neutral-50 transition-colors" id="cancelAuditBtn">取消</button>
            <button class="flex-1 py-2 bg-primary text-white rounded-lg hover:bg-primary/90 transition-colors" id="confirmAuditBtn">确认提交</button>
        </div>
    </div>
</div>

<!-- 认领模态框 -->
<div class="fixed inset-0 bg-black/50 z-50 hidden items-center justify-center" id="claimModal">
    <div class="bg-white rounded-xl w-full max-w-md p-6">
        <h3 class="text-lg font-bold mb-2">认领任务</h3>
        <p class="text-neutral-500 mb-4" id="claimModalMessage">您确定要认领此认证审核任务吗？认领后其他审核员将无法操作。</p>
        <div class="flex space-x-3">
            <button class="flex-1 py-2 border border-neutral-200 rounded-lg hover:bg-neutral-50 transition-colors" id="cancelClaimBtn">取消</button>
            <button class="flex-1 py-2 bg-primary text-white rounded-lg hover:bg-primary/90 transition-colors" id="confirmClaimBtn">确认认领</button>
        </div>
    </div>
</div>

<!-- 复查标记模态框 -->
<div id="reviewModal" class="fixed inset-0 bg-black/50 z-50 hidden items-center justify-center">
    <div class="bg-white rounded-xl w-full max-w-md p-6 border border-neutral-200 shadow-sm">
        <div class="flex items-center justify-between mb-4">
            <h3 class="text-lg font-bold">标记复查</h3>
            <button type="button" class="text-neutral-400 hover:text-neutral-600" id="closeReviewModal">
                <i class="fa fa-times"></i>
            </button>
        </div>
        
        <div class="space-y-4">
            <div>
                <label class="block text-sm font-medium text-neutral-700 mb-1">复查原因（可选）</label>
                <textarea id="reviewRemark" class="w-full bg-neutral-100 border border-neutral-200 text-sm rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-primary/30 focus:border-primary" rows="3" placeholder="请输入需要复查的原因"></textarea>
            </div>
        </div>
        
        <div class="flex space-x-3 mt-6">
            <button id="cancelReview" type="button" class="flex-1 py-2 border border-neutral-200 rounded-lg hover:bg-neutral-50 transition-colors text-neutral-700">
                取消
            </button>
            <button id="confirmReview" type="button" class="flex-1 py-2 bg-warning text-white rounded-lg hover:bg-warning/90 transition-colors">
                确认标记
            </button>
        </div>
    </div>
</div>

<script src="/i/js/certification.js"></script>